﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Models.Scheme.DefaultModel>" %>
<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%TempData["type.SelfOpenWin"] = "SelfOpenWin"; %>
	方案管理
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div>
    <%Html.BeginForm(); %>
        <%=Html.HiddenFor(p=>p.type) %>
        <table class="table" width='100%'>
            <tr class="th"><th colspan="5" align="left">&nbsp;查找条件</th></tr>
            <tr>
                <td ><%=Html.LabelFor(p=>p.where.LotteryID) %><%=Html.DropDownListFor(p=>p.where.LotteryID,Model.LotteryIDs,"所有彩种") %></td>
                <td ><%=Html.LabelFor(p=>p.where.WinModelID) %><%=Html.DropDownListFor(p=>p.where.WinModelID,Model.WinModels,"所有模式") %></td>
                <td><%=Html.LabelFor(p=>p.where.ConsumptionRatio) %><%=Html.DropDownListFor(p=>p.where.ConsumptionRatio,Model.ConsumptionRatios,"所有模式") %></td>
                <td ><%=Html.LabelFor(p=>p.where.State) %><%=Html.DropDownListFor(p=>p.where.State,Enum.GetValues(typeof(SchemeState)).Cast<SchemeState>().Where(p=>p!=SchemeState.Normal).Select(p=>new SelectListItem{Selected=(short)p==Model.where.State,Text=p.GetName(),Value=((short)p).ToString()}),"所有状态")%></td>
                <td ><input type="submit" value="查找" /></td>
            </tr>
        </table>
    <%Html.EndForm(); %>
</div>
<p></p>
<div>
    <table class="table" width='100%'>
        <tr class="th">
            <th>彩种</th><th>期号</th><th>方案金额</th><th>总注数</th><th>方案奖金</th><th>用户奖金</th><th>开奖号码</th><th>奖金模式</th><th>元角模式</th><th>状态</th><th>操作</th>
        </tr>
        <% 
            var i = 0; foreach (var item in Model.SchemeDetail)
           {
               %>
                <tr  <%=i++%2==1?"class='supersede'":"" %> id='tr_<%=i %>'>
                    <td><%=item.LotteryName%></td>
                    <td><%=item.IssueNumber%></td>
                    <td><%=item.SchemeMoney%></td>
                    <td><%=item.SchemeCount%></td>
                    <td class='td_money'><font color='red'><%=item.SchemeWinMoney %></font></td>
                    <td ><font color='red'><%=item.UserWinMoney %></font></td>
                    <td><%=item.SchemeOpenCode %></td>
                    <td><%=item.WinModelName %></td>
                    <td><%=item.ConsumptionRatioName %></td>
                    <td class="State"><%=((SchemeState)item.SchemeState).GetName()%></td>
                    <td>
                        <a class="a_blue" href='<%=Url.Action("HistoryDetail",Url.Route(new {Model.where,item.SchemeMultiple, SchemeAddTime = item.AddTime, item.IsChaseTask, item.SchemeID, SI_Pg = Model.pageInfo.CurrPage })) %>'>详情</a>&nbsp;
                        <%var state = ((SchemeState)item.SchemeState);
                          if (item.SchemeOpenCode!=null&&(state == SchemeState.OutBill || state == SchemeState.TimeOutCancel||state==SchemeState.Normal))
                          {
                              %>
                                <a href='#' class='a_blue' onclick="return SelfOpenWin('<%=Url.Action("SelfOpenWin", new {ID=item.SchemeID })%>',<%=i %>,this)">自助补奖</a>
                              <%
                          }
                         %> 
                    </td>
                </tr>
               <%
            }
            var page = Model.pageInfo;
            if (page != null)
            {
           %>
                <tr>
                <td colspan='11'>
                    <%=Html.Pager(page.CurrPage, page.PageCount, page.SunCount, "History", "pageInfo.CurrPage", Url.Route(new { Model.where }), "pageInfo.PageCount")%>
                </td>
                </tr>
           <%} %>
    </table>
</div>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="StyleAndScript" runat="server">
<style type="text/css">
    .tab{ border:1px solid;}
</style>
 <script src='<%=Url.Content("~/Scripts/Play/play.js") %>' type="text/javascript"></script>
<script type="text/javascript">
    function SelfOpenWin(url, index,obj) {
        var td1 = $('#tr_' + index + ' .State');
        var td_money = $('#tr_' + index + ' .td_money');
        Site.getJSON(url, null, function (result) {
            if (result.count > 0) {
                obj.style.display = 'none';
            }
            if (result.state.length) {
                td1.text(result.state);
            }
            if (result.msg.length) {
                alert(result.msg);
            }
            if (result.winMoney > 0) {
                td_money.text(result.winMoney);
            }
        });
        return false;
    }
</script>
</asp:Content>
